﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data;

/// <summary>
///db_blogroll 的摘要说明
/// </summary>
public class db_blogroll
{
    SqlDBClass db;
	public db_blogroll()
	{
        db = new SqlDBClass();
	}

    /// <summary>
    /// 查询所有 友情链接
    /// </summary>
    /// <returns></returns>
    public DataSet selectBlogrollALL() {
        //blogroll
        string strsql = "select * from blogroll order by id desc";
        return db.execSql(strsql);
    }

    /// <summary>
    /// 查询单个 友情链接
    /// </summary>
    /// <param name="id"></param>
    /// <returns></returns>
    public DataSet selectBlogrollONE(string id)
    {
        //blogroll
        string strsql = "select * from blogroll where id=" + id; ;
        return db.execSql(strsql);
    }

    /// <summary>
    /// 删除友情链接
    /// </summary>
    /// <param name="id"></param>
    /// <returns></returns>
    public Boolean delBlogroll(string id)
    {  
        string strsql = "delete from blogroll where id=" + id;
        return db.execSqlNoQuery(strsql);
    }

    /// <summary>
    /// 增加友情链接
    /// </summary>
    /// <param name="siteName"></param>
    /// <param name="sitelink"></param>
    /// <param name="siteLogo"></param>
    /// <param name="alt"></param>
    /// <returns></returns>
    public Boolean addBlogroll(string siteName,string sitelink,string siteLogo,string alt) {
        string strsql = "Insert Into blogroll(siteName,sitelink,siteLogo,siteAlt) Values('" + siteName + "','" + sitelink + "','" + siteLogo + "','" + alt + "')";
        return db.execSqlNoQuery(strsql);
    }

    /// <summary>
    /// 更新友情链接
    /// </summary>
    /// <param name="id"></param>
    /// <param name="siteName"></param>
    /// <param name="sitelink"></param>
    /// <param name="siteLogo"></param>
    /// <param name="siteAlt"></param>
    /// <returns></returns>
    public Boolean updateBlogroll(string id, string siteName, string sitelink, string siteLogo, string siteAlt)
    {
        string strsql = "update blogroll set siteName='" + siteName + "',sitelink='" + sitelink + "',siteLogo='" + siteLogo + "',siteAlt='"+siteAlt+"' where id=" + id;
        return db.execSqlNoQuery(strsql);
    }
}